-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add animated class to the dotted links #5650
base: develop
Are you sure you want to change the base?
Add animated class to the dotted links #5650
Conversation
✅ Deploy Preview for mermaid-js ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #5650 +/- ##
==========================================
- Coverage 5.85% 5.85% -0.01%
==========================================
Files 274 274
Lines 41112 41132 +20
Branches 488 488
==========================================
Hits 2408 2408
- Misses 38704 38724 +20
Flags with carried forward coverage won't be shown. Click here to find out more.
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks SO cool!! Great work 🚀
To give you more context into our syntax design philosophy, our core principle is that a change we introduce shouldn't break existing features. So we tend to have a thorough process whenever there are syntax changes. As internal implementations are easier to change without affecting users, those get little less scrutiny.
I was playing around with it, and there is a small issue I noticed. We are adding the :::animated
class on a node, not an edge. That means, all the edges originating from that node will be animated automatically.
We should brainstorm to find a way to select individual edges if possible.
I really love the simplicity of the current syntax. So maybe we can keep that, and add something to make individual edges animated in a later release.
Another useful feature would be a config option, which would enable animation for the whole diagram.
---
config:
animated: true
---
<diagram>
Btw, all these are not blockers for this PR.
0a6201f
to
84b10ac
Compare
f468686
to
2d9682e
Compare
The purpose of this PR is to add more clarity to a diagram and to how the nodes of a diagram communicate Adding `producer`/`consumer` pair classes to nodes, will add the `animated` class to an egde ot type 'arroe-point' having stroke 'dotted' Eg. ```mermaid graph LR A:::producer -.-> B:::consumer -.-> A -.-> C ```
2d9682e
to
22d0f40
Compare
@cmnstmntmn This kinda breaks the simplicity we had with the
What if, we add Just to be clear, I want your opinion on this, please don't write code 😅, we can discuss and finalise an approach and then write code. 😇
And maybe if we play around with the parsing a bit, we might be able to isolate just the edge that needs to be animated. I can help with that part. |
yeap, having .animate on both ends seems easier and more generic |
Hello! Thanks @cmnstmntmn for pitching in! This has led us to use the order of appearance for applying styles to edges. This approach comes with its own set of problems. If you introduce a new edge that can shuffle styling around, this approach could be used for animation as well. In your example, @sidharthv96, with classes applied to both nodes as selectors, we will run into trouble when there is more than one edge and we want to apply the style to one of the edges. I think it is time to solve this more robustly. I suggest that we introduce a way to attach an ID to an edge using the syntax itself without relying on work-arounds. I am not saying this change needs to be done in this PR, but it should be the way to select an edge for styling. Some spitballing - It could look something like this:
Where the label ends with the id statement we set the id of the label in the db when creating the label. Then we can use the class statement perhaps:
We could also allow classes directly in the id statement:
would work with style statements as well:
We need to think through the actual syntax in the edge label, as once we introduce it, we are stuck with it. My own objection to {id: one, class: animate} is that it looks very similar to a decision making the diagram harder to read. Something along those lines would be good though. |
📑 Summary
The purpose of this PR is to add more clarity to a
diagram and to how the nodes of a diagram communicate
Adding
animate
class to a node, will add theanimated
class to an edge of typearrow-point
having stroke
dotted
Eg.
Resolves #5574
📏 Design Decisions
Since creating keyframes animations was not possible,
a
.producer
/.consumer
class pair has been added to the project.It can be used only on dotted links.
Eg.
📋 Tasks
Make sure you
MERMAID_RELEASE_VERSION
is used for all new features.develop
branch